import { useI18n } from '/@/hooks/web/useI18n';
import { BasicColumn, BasicTableProps, FormProps } from '/@/components/Table';
import { ocrTempateCategoryListData } from '/@/api/ocr/ocrTempateCategory';

const { t } = useI18n('sys.ocrTempateCategory');

const modalProps = {
  title: t('模板分类选择'),
};

const searchForm: FormProps = {
  baseColProps: { lg: 6, md: 8 },
  labelWidth: 90,
  schemas: [
    {
      label: t('名称'),
      field: 'tempateCategoryName',
      component: 'Input',
    },
    {
      label: t('标签名'),
      field: 'tagName',
      component: 'Input',
    },
    {
      label: t('描述'),
      field: 'description',
      component: 'Input',
    },
    {
      label: t('训练数据集'),
      field: 'trainDataSet',
      component: 'Input',
    },
    {
      label: t('训练模型集'),
      field: 'trainModeSet',
      component: 'Input',
    },
    {
      label: t('训练推理集'),
      field: 'trainInferSet',
      component: 'Input',
    },
    {
      label: t('训练详情'),
      field: 'trainContent',
      component: 'Input',
    },
    {
      label: t('训练提示词集'),
      field: 'trainPromptSet',
      component: 'Input',
    },
    {
      label: t('状态'),
      field: 'status',
      component: 'Select',
      componentProps: {
        dictType: 'sys_search_status',
        allowClear: true,
      },
    },
    {
      label: t('备注信息'),
      field: 'remarks',
      component: 'Input',
    },
  ],
};

const tableColumns: BasicColumn[] = [
  {
    title: t('名称'),
    dataIndex: 'tempateCategoryName',
    key: 'a.tempate_category_name',
    sorter: true,
    width: 230,
    align: 'left',
    slot: 'firstColumn',
  },
  {
    title: t('标签名'),
    dataIndex: 'tagName',
    key: 'a.tag_name',
    sorter: true,
    width: 130,
    align: 'left',
  },
  {
    title: t('描述'),
    dataIndex: 'description',
    key: 'a.description',
    sorter: true,
    width: 130,
    align: 'left',
  },
  {
    title: t('训练数据集'),
    dataIndex: 'trainDataSet',
    key: 'a.train_data_set',
    sorter: true,
    width: 130,
    align: 'left',
  },
  {
    title: t('训练模型集'),
    dataIndex: 'trainModeSet',
    key: 'a.train_mode_set',
    sorter: true,
    width: 130,
    align: 'left',
  },
  {
    title: t('训练推理集'),
    dataIndex: 'trainInferSet',
    key: 'a.train_infer_set',
    sorter: true,
    width: 130,
    align: 'left',
  },
  {
    title: t('训练详情'),
    dataIndex: 'trainContent',
    key: 'a.train_content',
    sorter: true,
    width: 130,
    align: 'left',
  },
  {
    title: t('训练提示词集'),
    dataIndex: 'trainPromptSet',
    key: 'a.train_prompt_set',
    sorter: true,
    width: 130,
    align: 'left',
  },
  {
    title: t('排序号'),
    dataIndex: 'treeSort',
    key: 'a.tree_sort',
    sorter: true,
    width: 130,
    align: 'center',
  },
  {
    title: t('状态'),
    dataIndex: 'status',
    key: 'a.status',
    sorter: true,
    width: 130,
    align: 'center',
    dictType: 'sys_search_status',
  },
  {
    title: t('更新时间'),
    dataIndex: 'updateDate',
    key: 'a.update_date',
    sorter: true,
    width: 130,
    align: 'center',
  },
  {
    title: t('备注信息'),
    dataIndex: 'remarks',
    key: 'a.remarks',
    sorter: true,
    width: 130,
    align: 'left',
  },
];

const tableProps: BasicTableProps = {
  api: ocrTempateCategoryListData,
  beforeFetch: (params) => {
    params['isAll'] = true;
    return params;
  },
  columns: tableColumns,
  formConfig: searchForm,
  rowKey: 'tempateCategoryCode',
};

export default {
  modalProps,
  tableProps,
  itemCode: 'tempateCategoryCode',
  itemName: 'tempateCategoryCode',
  isShowCode: false,
};
